package com.netty.utils;

import com.netty.client.socket.ImSocketClient;

import java.util.concurrent.*;

public class DefaultTaskService {
    ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10);
    ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new SynchronousQueue());

    public void createTask(String name,Runnable task){
        TimedSupervisorTask heartbeat = new TimedSupervisorTask(
                name,
                scheduledExecutorService,
                threadPoolExecutor,
                10,
                TimeUnit.SECONDS,
                10,
                task);
        scheduledExecutorService.schedule(heartbeat, 10, TimeUnit.SECONDS);
    }




}

